<?php namespace Home\Controller; 

use Hdphp\Controller\Controller;

//首页控制器
class IndexController extends Controller{
    protected $db;
	//构造函数
	public function __init()
	{
		$this->db = new \Common\Model\Category;
	}
	
    //动作
    public function index(){
       //获取分类旧数据
	   $cateData = $this->db->orderby('category_sort','asc')->get();
	   $cateData = Data::channelLevel($cateData, $pid = 0, $html = "&nbsp;", $fieldPri = 'category_id', $fieldPid = 'category_pid', $level = 1);
	   //分配到页面上
	   View::with('cateData',$cateData);
	   //获取商品的前十个
	   $popData = Db::table('goods')->limit(1,10)->get();
	   View::with('popData',$popData);
       View::make();
    }
}
